package com.cdd.agent.controller;

import com.cdd.common.core.controller.BaseController;
import com.cdd.common.core.page.TableDataInfo;
import com.cdd.agent.api.domain.dto.AgentIncomeDto;
import com.cdd.agent.api.domain.dto.AgentTxMingxiDto;
import com.cdd.agent.api.domain.dto.AgentUserDto;
import com.cdd.agent.api.domain.vo.AgentIncomeVo;
import com.cdd.agent.api.domain.vo.AgentTxMingxiVo;
import com.cdd.agent.api.domain.vo.AgentUserVo;
import com.cdd.agent.api.domain.vo.AgentZhuBoVo;
import com.cdd.agent.api.service.AgentUserCountService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/agent")
public class AgentCountController extends BaseController {

    @Resource
    private AgentUserCountService agentUserCountService;

    /**
     * @desc 邀请的用户
     */
    @GetMapping("/user/list")
    public TableDataInfo getTxList(AgentUserDto dto) {
        dto.setUserId(getUserId());
        startPage();
        List<AgentUserVo> list = agentUserCountService.getAgentUserList(dto);
        return getDataTable(list);
    }

    /**
     * @desc 邀请的主播
     */
    @GetMapping("/zhubo/list")
    public TableDataInfo getZhuboList(AgentUserDto dto) {
        dto.setUserId(getUserId());
        startPage();
        List<AgentZhuBoVo> list = agentUserCountService.getAgentZhuBoList(dto);
        return getDataTable(list);
    }

    /**
     * @desc 提现记录
     */
    @GetMapping("/tx/list")
    public TableDataInfo getZhuboList(AgentTxMingxiDto dto) {
        dto.setUserId(getUserId());
        startPage();
        List<AgentTxMingxiVo> list = agentUserCountService.getAgentTxMingxi(dto);
        return getDataTable(list, agentUserCountService.getAgentTxMingxiCount(dto));
    }

    /**
     * @desc 收入流水
     */
    @GetMapping("/income/list")
    public TableDataInfo getAgentIncomeList(AgentIncomeDto dto) {
        dto.setUserId(getUserId());
        startPage();
        List<AgentIncomeVo> list = agentUserCountService.getAgentIncomeList(dto);
        return getDataTable(list);
    }

}
